package StudyCode.summary.zipfile;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CopyBytesFromALargeOver2GBInputStreamToAnOutputStream {
	private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;

	static long copyLarge(InputStream input, OutputStream output)
			throws IOException {
		byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
		long count = 0;
		int n = 0;
		while (-1 != (n = input.read(buffer))) {
			output.write(buffer, 0, n);
			count += n;
		}
		return count;
	}
}
